<!--督导评教-->
<template>
  <div class="wrapper-container"  style="width:100%">
    <div class="search-container" style="margin:0">
      <div class="search-container-left">
        <div class="search-container-item">
          <span>学期：</span>
          <el-select
            v-model="trem"
            style="width: 90px"
            size="mini"
            placeholder="请选择"
          >
            <el-option
              v-for="item in xqList"
              :key="item.xqmc"
              :label="item.xqmc"
              :value="item.xqmc"
            >
            </el-option>
          </el-select>
        </div>
        <div class="search-container-item">
          <span>月份：</span>
          <el-select
            v-model="yuefen"
            style="width: 88px"
            size="mini"
            placeholder="请选择"
          >
            <el-option
              v-for="item in yfList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </div>
        <div class="search-button">
          <img src="../../../assets/assessment/icon-search.png" alt=""/>
          <span @click="selectstat">查询</span>
        </div>
      </div>
      <div class="search-container-right">
        <div class="add-button"  style="width:100px;margin:0;background:rgb(255 239 239);border:1px solid #ff3819">
          <router-link :to="'/teacher/appraisal/supervision'">
            <span style="color: #ff3819;">督导评教</span>
          </router-link>
        </div>
      </div>
    </div>
    <div class="table-container">
      <el-table
        :data="tableData"
        class="xpaas-table-class"
        row-class-name="xpaas-row-class"
        cell-class-name="xpaas-cell-class"
        header-row-class-name="xpaas-header-row-class"
        header-cell-class-name="xpaas-header-cell-class"
      >
       
        <el-table-column prop="date" label="年月" align="center">
        </el-table-column>
        <el-table-column
          prop="time1"
          label="专项督导课时"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="time2"
          label="日常听课课时"
          align="center"
        >
        </el-table-column>
        <el-table-column prop="time3" label="总课时" align="center">
        </el-table-column>
        <el-table-column
          prop="many"
          label="听课总次数"
          align="center"
        >
        </el-table-column>
        <el-table-column prop="bili0" label="优" align="center">
        </el-table-column>
        <el-table-column
          prop="bili1"
          label="比例"
          align="center"
        >
        </el-table-column>
        <el-table-column prop="bili2" label="良" align="center">
        </el-table-column>
        <el-table-column
          prop="bili3"
          label="比例"
          align="center"
        >
        </el-table-column>
        <el-table-column prop="bili4" label="中" align="center">
        </el-table-column>
        <el-table-column
          prop="bili5"
          label="比例"
          align="center"
        >
        </el-table-column>
        <el-table-column prop="bili6" label="差" align="center">
        </el-table-column>
        <el-table-column
          prop="bili7"
          label="比例"
          align="center"
        >
        </el-table-column>
      </el-table>
      <!-- <div class="pagination-block">
        <el-pagination
          style="float: right;"
          prev-text="上一页"
          next-text="下一页"
          :page-size="2"
          @current-change="handleCurrentChange"
          layout="prev, pager, next, jumper"
          :total=total
        >
        </el-pagination>
      </div> -->
    </div>
  </div>
</template>

<script>
import {statistical} from "@/api/teacher/supervision";
import {
  reqGetXqList
} from "@/api/course/courses";

export default {
  data() {
    return {
      total:'',
      tremid: '',
      name: '',
      trem: '',
      xqList: [],
      yuefen: '',
      yfList: [
        {
          value: "01月",
          label: "01月",
        },
        {
          value: "02月",
          label: "02月",
        },
        {
          value: "03月",
          label: "03月",
        },
        {
          value: "04月",
          label: "04月",
        },
        {
          value: "05月",
          label: "05月",
        },
        {
          value: "06月",
          label: "06月",
        },
        {
          value: "07月",
          label: "07月",
        },
        {
          value: "08月",
          label: "08月",
        },
        {
          value: "09月",
          label: "09月",
        },
        {
          value: "10月",
          label: "10月",
        },
        {
          value: "11月",
          label: "11月",
        },
        {
          value: "12月",
          label: "12月",
        }
      ],
      tableData: [],
    };
  },

  mounted() {
    this.getXqList();
    // this.statistical()
  },
  methods: {
    handleCurrentChange(val) {
      this.current = val
      this.statistical()
      console.log(this.current,"999888")
    },
    // 获取学期院历列表
    async getXqList() {
      const result = await reqGetXqList();
      if (result.data.code == 200) {
        this.xqList = result.data.data;
        this.trem = result.data.data.length > 0 ? result.data.data[0].xqmc : '';
        this.statistical()
      }
    },
    //督导评教
    statistical() {
      let obj = {
        name: this.name,
        trem: this.trem,
        tremid: this.tremid,
        yuefen: this.yuefen,
      }
      return new Promise(() => {
        //教员查询到所有数据
        console.log("==================督导评教=================");
        statistical(obj).then(res => {
          this.tableData = res.data.msg == "暂无承载数据" ? [] : res.data.data;
          this.total = res.data.msg == "暂无承载数据" ? '' : res.data.data.length;
          for (let a = 0; a < this.tableData.length; a++) {
            this.tableData[a].biliList = this.tableData[a].bili.split(",")
            for (let i = 0; i < this.tableData[a].biliList.length; i++) {
              this.tableData[a]['bili' + i] = this.tableData[a].biliList[i]
            }
          }

        })
      })
    },

    //查询跳转
    selectstat() {
      let obj = {
        name: this.name,
        trem: this.trem,
        tremid: this.tremid,
        yuefen: this.yuefen,
      }
      return new Promise(() => {
        //教员查询到所有数据
        console.log("==================督导评教=================");
        statistical(obj).then(res => {
          this.tableData = res.data.msg == "暂无承载数据" ? [] : res.data.data;
          this.total = res.data.msg == "暂无承载数据" ? '' : res.data.data.length;
          for (let a = 0; a < this.tableData.length; a++) {
            this.tableData[a].biliList = this.tableData[a].bili.split(",")
            for (let i = 0; i < this.tableData[a].biliList.length; i++) {
              this.tableData[a]['bili' + i] = this.tableData[a].biliList[i]
            }
          }
          console.log("输出", this.tableData);
        })
      })
    },
  },
};
</script>
<style lang="less" scoped>
@fontFamily:"Microsoft YaHei";
.xpaas-table-class {
  border: 1px solid #004ca7;
  border-radius: 9px;
  margin: 15px 0;
  > ::v-deep div.el-table__header-wrapper {
    > table.el-table__header {
      > thead {
        > tr.xpaas-header-row-class {
          padding: 0;
          height: 76px;
          background-color: #edf2f9;
          font-size: 16px;
          font-family: Microsoft YaHei;
          font-weight: bold;
          line-height: 20px;
          color: #004ca7;
          > th.xpaas-header-cell-class {
            font-weight: bold;
            border-right: 1px solid #c7d7eb;
            border-left: 0;
            border-bottom: 1px solid #c7d7eb;
            background-color: #edf2f9;
            > div.cell {
              font-size: 16px;
              font-weight: bold;
              font-family: @fontFamily;
              color: #004ca7;
            }
          }
        }
      }
    }
  }
  > ::v-deep div.el-table__body-wrapper {
    > table.el-table__body {
      > tbody {
        > tr.xpaas-row-class {
          > td.xpaas-header-cell-class {
            border-right: 1px solid #c7d7eb;
            border-left: 0;
            border-bottom: 1px solid #c7d7eb;
            background-color: #edf2f9;
            > div.cell {
              font-size: 16px;
              font-weight: bold;
              font-family: @fontFamily;
              color: #004ca7;
            }
          }
          > td.xpaas-cell-class {
            height: 76px;
            border-right: 1px solid #c7d7eb;
            border-left: 0;
            border-bottom: 1px solid #c7d7eb;
            > div.cell {
              font-weight: normal;
              font-family: @fontFamily;
              color: #004ca7;
            }
          }
        }
      }
    }
  }
}
.table-container {
  margin-top: 15px;

  .el-table td,
  .el-table th.is-leaf,
  .el-table--border,
  .el-table--group {
    border-color: #c7d7eb;
  }

  .el-table__header tr,
  .el-table__header th {
    padding: 0;
    height: 76px;
    background-color: #edf2f9;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    line-height: 20px;
    color: #004ca7;
  }

  .el-table__body tr,
  .el-table__body td {
    padding: 0;
    height: 86px;
  }

  .wrapper-button {
    display: flex;
    flex-direction: column;
    align-items: center;

    > div {
      margin-bottom: 8px;
    }
  }
}
</style>

<style lang="less" scoped>
@import "../../../styles/supervision.less";

.wrapper-container {
  width: 1711px;
  margin: 0 auto;
}

.table-container {
  margin-top: 15px;

  .table-data {
    width: 100%;
    border: 0.8px solid #004ca7;
    border-radius: 9px;
    font-size: 14px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #004ca7;
  }
}
</style>
